"use strict";
cc._RF.push(module, 'fd915YPt2FPGJbY2fboN+mT', 'Mission');
// Script/Mission.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    // labellist: {
    // 	default: null,
    // 	type: cc.Label
    // },
    //peopleRun:{ default: null, type: cc.Animation },
    showTimes: 1,
    //隐藏时间
    jumpHeight: 100,
    //跳跃高度
    _isShow: false
  },
  // LIFE-CYCLE CALLBACKS:
  // setLabelString: function(str) {
  //	var	label=this.node.getChildByName("label").getComponent(cc.Label);
  //	label.string = str;
  // 	label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
  // 	label._forceUpdateRenderData(true); // 这里调用一次手动渲染
  // },
  // LIFE-CYCLE CALLBACKS:
  onLoad: function onLoad() {
    var label = this.node.getChildByName("label").getComponent(cc.Label);
    label.string = '';
    var strText = '';
    var that = this;
    var sendData = {
      "TaskGuid": "slkdjflie09876",
      "DataType": "usergylist",
      "userid": "1"
    };
    var xhr = new XMLHttpRequest();

    xhr.onreadystatechange = function () {
      if (xhr.readyState == 4 && xhr.status >= 200 && xhr.status < 400) {
        var response = xhr.responseText;
        var info = eval('(' + response + ')');
        var infores = eval('(' + info + ')'); //cc.log(infores);

        infores.forEach(function (item, index) {
          //  cc.log(item,index);    // 1 0
          strText += item.name + '-' + item.zt + '\n';
          label.string += item.name + '-' + item.zt + '\n\n';
        });
        cc.log(strText);
      }
    }; // xhr.open("GET", seturl+'/'+JSON.stringify(sendData), true);


    xhr.open("GET", url + JSON.stringify(sendData), true);
    xhr.send(); //	cc.log("showTips.onLoad")

    window.showtips = this; // 初始化计时器

    this.timer = 0;
    this.node.active = true;
    this.node.getChildByName("closeBtn").on('touchend', function (event) {
      this.finish();
    }, this); //      this.node.getChildByName("startBtn").on('touchend',function(event){
    //          console.log("点击到开始");
    // //this.peopleRun.play();
    //      },this);
    //this.node.getChildByName("btnconfir").on('click',function(event){
    //console.log("点击到按钮");
    //},this);
  },
  setJumpAction: function setJumpAction() {
    this.timer = 0; // 跳跃

    var jumpDown = cc.moveBy(this.showTimes, cc.v2(0, this.jumpHeight)).easing(cc.easeCubicActionIn());
    var callback = cc.callFunc(this.finish, this);
    return cc.repeat(cc.sequence(jumpDown, callback), 1);
  },
  finish: function finish() {
    isShow = 0;
    this._isShow = false;

    if (this.node) {
      this.node.active = this._isShow;
    }

    this.node.stopAllActions();
    this.node.destroy();
  },
  start: function start() {} // update (dt) {},

});

cc._RF.pop();